<template>
	<view class="page">
		<view class="" style="display: flex; justify-content: center;align-items: center;">
			<u-album :urls="urls1" keyName="src2"></u-album>
		</view>
		<!-- <image :src="urls" mode="" style="width: 200rpx;height: 200rpx;"></image> -->
		<view class="popup_s" v-if="popup_s" @click="popup_list"></view>
		<view class="popup_info" v-if="popup_s">
			<view style="width: 100%;height: 80rpx;position: relative;top: 0;left: 0;">
				<view style="position: absolute;top: 10rpx;left: 0;color: #fa4c4c;">
					选择小程序
				</view>
				<view style="position: absolute;top: 0;right: 0;font-size: 42rpx;color: #fa4c4c;" @click="popup_clo">
					×
				</view>
			</view>
			<scroll-view scroll-y class="popup_info_ten">
				<view v-for="(item,index) in user" :key="index" class="popup_name" @click="popup_name(item)">
					{{item.name.name}}
				</view>
			</scroll-view class="table" scroll-y style="height: 1100rpx;;">
		
		</view>
	</view>
</template>

<script>
	const index = require('@/api/index/index.js')
	export default {
		data() {
			return {
				urls: '',
				urls1: [{
					src2: '',
				}],
				popup_s:true,
				user:[]
			}
		},
		onLoad() {
			this.getApplet()
		},
		methods: {
			async getApplet() {
				let postData = {
					phone: uni.getStorageSync("user_name"),
				}
				let res = await index.getApplet(postData)
				if (res.code === 1) {
					this.user = res.data

				}
			},
			popup_name(item) {
				this.popup_s = false
				this.Distribution(item.name.appid)
			
			},
			
			async Distribution(appid) {
				let that = this;
				let data = {
					open_id: uni.getStorageSync("user_name"),
					app_id:appid ,
				};
				let result = await index.Distribution(data);
				if (result.code == 1) {
					// this.urls = result.data.path
					this.urls1[0].src2 = result.data.path
				}
			},
		}
	}
</script>

<style lang="scss">
	.page{
		width: 100%;
		height: 100vh;
		background-color: #fff;
		
		.popup_info {
			position: fixed;
			width: 530rpx;
			height: 743rpx;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			font-size: 30rpx;
			padding: 40rpx;
			overflow: hidden;
			background-image: url('https://jiangsudiantuo2022.oss-cn-hangzhou.aliyuncs.com/img/e89844bfef73c699ef06622d923147613e4585af.png');
			background-repeat: no-repeat;
			z-index: 9999;
			background-size: 100% 100%;
		
			.popup_info_ten {
				width: 100%;
				height: 400rpx;
				margin-top: 120rpx;
		
				.popup_name {
					width: 100%;
					height: 80rpx;
					background-color: #f8f8f8;
					margin-top: 10rpx;
					line-height: 80rpx;
					text-align: center;
		
				}
			}
		
		}
		.popup_s {
			position: fixed;
			left: 0;
			right: 0;
			top: 0;
			width: 100vw;
			height: 100%;
			background-color: rgba(0, 0, 0, 0.8);
			z-index: 9998;
		}
	}
</style>